/*
 * Copyright © 2021 http://www.TestCopyright.com/ All rights reserved.
 */
package com.xjh.controller;

import com.xjh.bo.StudentBO;
import com.xjh.utils.resultutils.ResponseObj;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author： 徐建华
 * @date： 2021/11/28
 * @description：
 * @modifiedBy：
 * @version: 1.0
 */
//return直接是字符串
@RestController
@RequestMapping("/test")

public class HelloController {

    @ResponseBody
    @RequestMapping("/hello")
    public ResponseObj hello() {
        // 创建一个对象
        StudentBO studentBO = new StudentBO();
        studentBO.setId(1L);
        studentBO.setStuName("张三");
        studentBO.setStuSex("男");

        StudentBO studentBO1 = new StudentBO();
        studentBO1.setId(2L);
        studentBO1.setStuName("李四");
        studentBO1.setStuSex("女");
        List<StudentBO> studentList = new ArrayList<>();
        studentList.add(studentBO1);
        studentList.add(studentBO);

        return new ResponseObj().ok(studentList);
    }
}
